/*
 * Copyright (C), 2002-2018, 上海巧房信息技术有限公司
 * FileName: GetPremisesDynamicHander.java
 * Author:   liushihao
 * Date:     2018年6月13日 下午2:15:38
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>;    <time>     <version>   <desc>
 * 修改人姓名     修改时间    版本号       描述
 */
package com.yixun.qfbao.hander;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import com.yixun.qfbao.api.service.PremisesDynamicApiService;
import com.yixun.qfbao.apidto.GetPremisesDynamicResDto;
import com.yixun.qfbao.constants.OpenApiConstant;
import com.yixun.qfbao.vo.GetPremisesDynamicReqVo;
import com.yixun.qfbao.xf.model.dto.PremisesDynamicResultDto;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * 功能描述: <br/>
 * 楼盘动态
 *
 * @author liushihao
 * @see [相关类/方法](可选)
 * @since [产品/模块版本](可选)
 */
@Service("getPremisesDynamicHander")
public class GetPremisesDynamicHander {
	private static final Logger logger = LoggerFactory.getLogger(GetPremisesDynamicHander.class);

	@Autowired
	private PremisesDynamicApiService premisesDynamicApiService;

	public GetPremisesDynamicResDto hander(GetPremisesDynamicReqVo reqVo) {
		GetPremisesDynamicResDto resDTO = new GetPremisesDynamicResDto();
		try {
			Assert.notNull(reqVo.getParams().getPremisesId(), "楼盘ID为空");
			List<PremisesDynamicResultDto> data = premisesDynamicApiService.getPremisesDynamicList(reqVo.getParams());
			resDTO.setData(data);
			resDTO.setResponseCode(ResultEnum.SUCCESS.getNo());
		} catch (Exception e) {
			resDTO.setResponseCode(OpenApiConstant.RC_EXCEPTION_ERROR.getResponseCode());
			resDTO.setResponseMessage(e.getMessage());
			logger.error("查询楼盘动态异常:{}", e);
		}
		return resDTO;
	}
}
